// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
import VueLazyload from 'vue-lazyload'
import store from './store'
Vue.use(VueAwesomeSwiper)
Vue.config.productionTip = false

Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4061473893,2964755823&fm=26&gp=0.jpg',
  loading: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1550142623466&di=25e4c268bcfaf3ffda014c7925b066cf&imgtype=0&src=http%3A%2F%2Ffiles.57gif.com%2Fwebgif%2F0%2Fb%2F1d%2Fba15df1856621af7249223de5e5df.gif',
  attempt: 1
})
// 全局钩子，每个地址都会走这个方法，所以在这里去获取meta然后赋值给title
// 这个方法中可以进行权限的校验或地址的拦截等
router.beforeEach(function (to, from, next) {
  document.title = to.meta.title
  next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
